package com.rtx.edi.platform.express.auth.service.impl;

import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.rtx.edi.model.express.auth.po.PlExpressTemplate;
import com.rtx.edi.platform.express.auth.mapper.PlExpressTemplateMapper;
import com.rtx.edi.platform.express.auth.service.PlExpressTemplateService;

@Service
public class PlExpressTemplateServiceImpl extends ServiceImpl<PlExpressTemplateMapper,PlExpressTemplate> implements PlExpressTemplateService {

	@Override
	public void selectByPage(Page<PlExpressTemplate> pageParam, PlExpressTemplate vo) {
		LambdaQueryWrapper<PlExpressTemplate> query = Wrappers.lambdaQuery();
		query.eq(PlExpressTemplate::getDeleteflag,"0");
		if(vo!=null) {
			query.eq(vo.getSalesp()!=null, PlExpressTemplate::getSalesp, vo.getSalesp())
			.eq(vo.getCpcode()!=null, PlExpressTemplate::getCpcode, vo.getCpcode())
			.eq(vo.getBrandcode()!=null, PlExpressTemplate::getBrandcode, vo.getBrandcode())
			.eq(vo.getStandardtemplateid()!=null, PlExpressTemplate::getStandardtemplateid, vo.getStandardtemplateid())
			.like(vo.getStandardtemplatename()!=null,PlExpressTemplate::getStandardtemplatename,vo.getStandardtemplatename())
			;
		}
		baseMapper.selectPage(pageParam, query);
		
	}

	@Override
	public boolean addPlExpressTemplate(PlExpressTemplate vo) {
		return baseMapper.insertPlExpressTemplate(vo)==1;
	}
	
	
}
